package com.qdh.demo7;


import org.apache.hadoop.mapreduce.Partitioner;

public class SubjectPartition extends Partitioner<DescIntWritable, Subject> {


    @Override
    public int getPartition(DescIntWritable descIntWritable, Subject subject, int i) {
        int partition;
        switch (subject.getClassName()){
            case "语文":
                partition = 0;
                break;
            case "数学":
                partition = 1;
                break;
            case "英语":
                partition = 2;
                break;
            default:
                partition = 3;
        }
        return partition;
    }
}
